home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ruthie / game2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  11.0 KB  |  337 lines

  1. VERSION 2.00
  2. Begin Form Game2 
  3.    Caption         =   "RuthieWare"
  4.    ClientHeight    =   9060
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1770
  7.    ClientWidth     =   10170
  8.    Height          =   9750
  9.    Icon            =   GAME2.FRX:0000
  10.    Left            =   1035
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   9060
  15.    ScaleWidth      =   10170
  16.    Top             =   1140
  17.    Width           =   10290
  18.    Begin Timer Timer2 
  19.       Left            =   4440
  20.       Top             =   8040
  21.    End
  22.    Begin PictureBox Storage 
  23.       BorderStyle     =   0  'None
  24.       Height          =   615
  25.       Index           =   3
  26.       Left            =   2400
  27.       Picture         =   GAME2.FRX:0302
  28.       ScaleHeight     =   615
  29.       ScaleWidth      =   615
  30.       TabIndex        =   7
  31.       Top             =   7680
  32.       Visible         =   0   'False
  33.       Width           =   615
  34.    End
  35.    Begin PictureBox Storage 
  36.       BorderStyle     =   0  'None
  37.       Height          =   495
  38.       Index           =   2
  39.       Left            =   1680
  40.       Picture         =   GAME2.FRX:106A
  41.       ScaleHeight     =   495
  42.       ScaleWidth      =   495
  43.       TabIndex        =   6
  44.       Top             =   7680
  45.       Visible         =   0   'False
  46.       Width           =   495
  47.    End
  48.    Begin PictureBox Storage 
  49.       BorderStyle     =   0  'None
  50.       Height          =   495
  51.       Index           =   1
  52.       Left            =   960
  53.       Picture         =   GAME2.FRX:148E
  54.       ScaleHeight     =   495
  55.       ScaleWidth      =   495
  56.       TabIndex        =   5
  57.       Top             =   7680
  58.       Visible         =   0   'False
  59.       Width           =   495
  60.    End
  61.    Begin PictureBox Storage 
  62.       BorderStyle     =   0  'None
  63.       Height          =   495
  64.       Index           =   0
  65.       Left            =   120
  66.       Picture         =   GAME2.FRX:2D5E
  67.       ScaleHeight     =   495
  68.       ScaleWidth      =   495
  69.       TabIndex        =   4
  70.       Top             =   7680
  71.       Visible         =   0   'False
  72.       Width           =   495
  73.    End
  74.    Begin PictureBox Actions 
  75.       BorderStyle     =   0  'None
  76.       Height          =   855
  77.       Left            =   5160
  78.       ScaleHeight     =   855
  79.       ScaleWidth      =   1695
  80.       TabIndex        =   9
  81.       Top             =   7560
  82.       Width           =   1695
  83.       Begin PictureBox GoToGame3 
  84.          BorderStyle     =   0  'None
  85.          Height          =   495
  86.          Left            =   1200
  87.          Picture         =   GAME2.FRX:404E
  88.          ScaleHeight     =   495
  89.          ScaleWidth      =   495
  90.          TabIndex        =   12
  91.          Top             =   0
  92.          Width           =   495
  93.       End
  94.       Begin PictureBox Quit 
  95.          BorderStyle     =   0  'None
  96.          Height          =   495
  97.          Left            =   600
  98.          Picture         =   GAME2.FRX:4350
  99.          ScaleHeight     =   495
  100.          ScaleWidth      =   495
  101.          TabIndex        =   11
  102.          Top             =   0
  103.          Width           =   495
  104.       End
  105.       Begin PictureBox GoToGame1 
  106.          BorderStyle     =   0  'None
  107.          Height          =   495
  108.          Left            =   0
  109.          Picture         =   GAME2.FRX:4652
  110.          ScaleHeight     =   495
  111.          ScaleWidth      =   495
  112.          TabIndex        =   10
  113.          Top             =   0
  114.          Width           =   495
  115.       End
  116.    End
  117.    Begin Timer Timer1 
  118.       Left            =   4440
  119.       Top             =   7560
  120.    End
  121.    Begin PictureBox Yippee 
  122.       BorderStyle     =   0  'None
  123.       Height          =   615
  124.       Left            =   3120
  125.       Picture         =   GAME2.FRX:4954
  126.       ScaleHeight     =   615
  127.       ScaleWidth      =   1215
  128.       TabIndex        =   13
  129.       Top             =   7440
  130.       Visible         =   0   'False
  131.       Width           =   1215
  132.    End
  133.    Begin PictureBox Picture2 
  134.       Height          =   7215
  135.       Left            =   6480
  136.       ScaleHeight     =   7185
  137.       ScaleWidth      =   465
  138.       TabIndex        =   2
  139.       Top             =   120
  140.       Width           =   495
  141.       Begin PictureBox Picture3 
  142.          BackColor       =   &H00C00000&
  143.          Height          =   960
  144.          Left            =   0
  145.          ScaleHeight     =   930
  146.          ScaleWidth      =   465
  147.          TabIndex        =   3
  148.          Top             =   6240
  149.          Width           =   495
  150.       End
  151.    End
  152.    Begin PictureBox Background 
  153.       BorderStyle     =   0  'None
  154.       Height          =   7215
  155.       Left            =   120
  156.       ScaleHeight     =   7215
  157.       ScaleWidth      =   6135
  158.       TabIndex        =   0
  159.       Top             =   120
  160.       Width           =   6135
  161.       Begin PictureBox FrownFace 
  162.          BorderStyle     =   0  'None
  163.          Height          =   2775
  164.          Left            =   1680
  165.          Picture         =   GAME2.FRX:A99A
  166.          ScaleHeight     =   2775
  167.          ScaleWidth      =   2895
  168.          TabIndex        =   8
  169.          Top             =   1920
  170.          Visible         =   0   'False
  171.          Width           =   2895
  172.       End
  173.       Begin PictureBox Picture1 
  174.          BorderStyle     =   0  'None
  175.          Height          =   1095
  176.          Left            =   120
  177.          Picture         =   GAME2.FRX:BBE8
  178.          ScaleHeight     =   1095
  179.          ScaleWidth      =   1215
  180.          TabIndex        =   1
  181.          Top             =   120
  182.          Width           =   1215
  183.       End
  184.    End
  185.    Begin Menu File 
  186.       Caption         =   "&File"
  187.       Begin Menu FileAbout 
  188.          Caption         =   "&About Ruthie"
  189.       End
  190.       Begin Menu FileExit 
  191.          Caption         =   "E&xit"
  192.       End
  193.    End
  194.    Begin Menu Game 
  195.       Caption         =   "&Game"
  196.       Begin Menu GameGame1 
  197.          Caption         =   "Game &1"
  198.       End
  199.       Begin Menu GameGame2 
  200.          Caption         =   "Game &2"
  201.          Checked         =   -1  'True
  202.       End
  203.       Begin Menu GameGame3 
  204.          Caption         =   "Game &3"
  205.       End
  206.    End
  207.    Begin Menu Instructions 
  208.       Caption         =   "&Instructions"
  209.       Begin Menu InstructionsGame2 
  210.          Caption         =   "Playing Game &2"
  211.       End
  212.    End
  213. Dim Counter As Integer
  214. Sub Background_Click ()
  215.     FrownFace.Top = (Background.Height - FrownFace.Height) / 2
  216.     FrownFace.Left = (Background.Width - FrownFace.Width) / 2
  217.     FrownFace.Visible = True  'Turns FrownFace on
  218.     Timer1.Interval = HOWLONG  'Sets clock for 3 seconds
  219. End Sub
  220. Sub FileAbout_Click ()
  221.     Open2.Show MODAL
  222. End Sub
  223. Sub FileExit_Click ()
  224.     End
  225. End Sub
  226. Sub Form_Load ()
  227.     Width = Screen.Width * .5
  228.     Height = Screen.Height * .75
  229.     Left = (Screen.Width - Width) / 2
  230.     Top = (Screen.Height - Height) * .4
  231.     Initialize
  232.     Picture1.Picture = Storage(0).Picture
  233. End Sub
  234. Sub Form_Resize ()
  235.     Scale                                   ' Reset scale to twips
  236.     If Game2.Height > 100 Then Initialize   ' If the Height is smaller, than it's been
  237.                                             ' minimized. We don't want to initialize if
  238.                                             ' that's the case.
  239. End Sub
  240. Sub GameGame1_Click ()
  241.     Game2.Hide
  242.     Ruthie.Show
  243. End Sub
  244. Sub GameGame2_Click ()
  245.     MsgBox "So, okay, we'll ask. If you are already playing Game 2, why are you clicking on this menu instruction?", 0, HEADER
  246. End Sub
  247. Sub GameGame3_Click ()
  248.     Game2.Hide
  249.     Game3.Show
  250. End Sub
  251. Sub GoToGame1_Click ()
  252.     Game2.Hide
  253.     Ruthie.Show
  254. End Sub
  255. Sub GoToGame3_Click ()
  256.     Game2.Hide
  257.     Game3.Show
  258. End Sub
  259. Sub Initialize ()
  260.     Game2.Scale (0, 0)-(75, 50)                 ' Define the scale for the form
  261.                                          
  262.     Background.Width = 60                       ' Place Background
  263.     Background.Height = 40
  264.     Background.Left = 3
  265.     Background.Top = 3
  266.     Background.Scale (0, 0)-(50, 65)            ' Define the live area scale
  267.     Picture1.Left = 25                          ' Place the starting picture
  268.     Picture1.Top = 25
  269.     Picture2.Width = 5                          ' Place and size the thermometer
  270.     Picture2.Height = 40
  271.     Picture2.Left = 65
  272.     Picture2.Top = 3
  273.     Picture2.Scale (0, 0)-(5, 96)               ' Define scale for the thermometer
  274.     Picture3.Width = Picture2.ScaleWidth        ' Place and size the "mercury"
  275.     Picture3.Height = Picture2.ScaleHeight / 8
  276.     Picture3.Top = Picture2.ScaleHeight - Picture3.Height
  277.     Picture3.Left = 0
  278.     Actions.Left = (Picture2.Left + Picture2.Width) - Actions.Width
  279.                                                 ' Place the action icons (Stop, Game2, etc.)
  280.     Actions.Top = 45
  281.     FrownFace.Left = (Background.ScaleWidth - FrownFace.Width) / 2
  282.     FrownFace.Top = (Background.ScaleHeight - FrownFace.Height) / 2
  283.     Yippee.Left = 3
  284.     Yippee.Top = 3
  285.     Yippee.Width = Game2.ScaleWidth * .9
  286.     Yippee.Height = Game2.ScaleHeight * .9
  287.     Game2.Refresh                               ' Force a refresh of all controls
  288.     Picture2.Refresh
  289.     Picture3.Refresh
  290.     Actions.Refresh
  291.     GoToGame1.Refresh
  292.     Quit.Refresh
  293.     GoToGame3.Refresh
  294.     Randomize                                   ' Reseed the random number generator
  295. End Sub
  296. Sub InstructionsGame2_Click ()
  297.     InstGame2.Show MODAL
  298. End Sub
  299. Sub Picture1_Click ()
  300. '   If the picture is successfully clicked, the "thermometer" in Picture2
  301. '   (the "mercury" is actually Picture3) will increase. Initially Picture3
  302. '   is set to a small height--it will grow for seven successful clicks.
  303. '   On the 8th successful click the thermometer will be filled, and the
  304. '   procedure will open a new picture, reset the thermometer, and start
  305. '   over.
  306.         
  307. '   First off, let's increase the size of the thermometer:
  308.     Increment = Picture2.ScaleHeight / 8
  309.     Picture3.Height = Picture3.Height + Increment
  310.     Picture3.Top = Picture3.Top - Increment
  311.         
  312. '   Now, let's move the picture.
  313.         
  314.     WidthFree = Background.ScaleWidth - Picture1.Width
  315.     HeightFree = Background.ScaleHeight - Picture1.Height
  316.     FinalX = Int(WidthFree * Rnd)
  317.     FinalY = Int(HeightFree * Rnd)
  318.     Picture1.Move FinalX, FinalY
  319.     If Picture3.Height >= (Picture2.ScaleHeight * .95) Then ' If thermometer close to the top, reset the picture
  320.         Yippee.Visible = True                               ' Turn on the success picture
  321.         Counter = (Counter + 1) Mod 4                       ' This is a rotating counter
  322.         Picture1.Picture = Storage(Counter).Picture
  323.         Picture3.Top = Picture2.ScaleHeight - Increment
  324.         Picture3.Height = Increment
  325.         Timer2.Interval = HOWLONG
  326.     End If
  327. End Sub
  328. Sub Quit_Click ()
  329.     End
  330. End Sub
  331. Sub Timer1_Timer ()
  332.     FrownFace.Visible = False   ' Turn FrownFace off
  333. End Sub
  334. Sub Timer2_Timer ()
  335.     Yippee.Visible = False
  336. End Sub
  337.